cmake_minimum_required(VERSION 2.8)
project(CalibrateImages)

# 设定 编译选项
IF(NOT CMAKE_BUILD_TYPE)
  SET(CMAKE_BUILD_TYPE Debug) # Release
ENDIF()

MESSAGE("Build type: " ${CMAKE_BUILD_TYPE})

# Check C++11 or C++0x support
include(CheckCXXCompilerFlag)
CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX14)
CHECK_CXX_COMPILER_FLAG("-std=c++0x" COMPILER_SUPPORTS_CXX0X)
if(COMPILER_SUPPORTS_CXX14)
   set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -pthread")
   add_definitions(-DCOMPILEDWITHC14)
   message(STATUS "Using flag -std=c++11.")
elseif(COMPILER_SUPPORTS_CXX0X)
   set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x -pthread")
   add_definitions(-DCOMPILEDWITHC0X)
   message(STATUS "Using flag -std=c++0x.")
else()
   message(FATAL_ERROR "The compiler ${CMAKE_CXX_COMPILER} has no C++11 support. Please use a different C++ compiler.")
endif()

# OpenCV
find_package( OpenCV REQUIRED )
include_directories( ${OpenCV_INCLUDE_DIRS} )

# Eigen
include_directories("/usr/include/eigen3")

# 划分 源文件夹和头文件夹
include_directories(${CMAKE_SOURCE_DIR}/Inc)
aux_source_directory(${CMAKE_SOURCE_DIR}/Src DIR_SRCS)

# 生成可执行文件
add_executable(${PROJECT_NAME} main.cpp ${DIR_SRCS})

# 链接动态库
target_link_libraries(${PROJECT_NAME}
    ${EIGEN3_LIBS}
    ${OpenCV_LIBS}
)


